# Replication Package: Demographics and the Impossible Trinity

## Overview
This folder contains all files needed to replicate the analysis in "Demographics and the Impossible Trinity." The paper shows that aging pushes countries toward higher exchange rate stability (Z1=1.45***) and financial openness (Z1=1.49***), with monetary independence OECD-specific (Z1=2.73***). Demographics moderate rather than mediate the trilemma: the Z1 x eurozone interaction is -3.67*** (OECD), and 11/16 EMU members would float if unconstrained.

## Requirements
- Python 3.10+
- pandas, numpy, scipy, statsmodels
- Data files in data/processed/

## Structure
- `scripts/` — Analysis scripts (run in phase order)
- `src/` — Shared modules (PanelGLS estimator, data loading, country classifications)
- `data/processed/` — Processed panel data (trilemma_panel.csv)
- `output/tables/` — Generated output tables
- `paper/` — Paper manuscript, figures, and references

## Reproduction
Run scripts in numerical phase order:
```
python scripts/phase1_data_assembly.py
python scripts/phase2_trilemma_regressions.py
python scripts/phase3_peg_float.py
python scripts/phase4_eurozone.py
python scripts/phase5_kaopen_mediation.py
python scripts/phase6_within_emu.py
...
python scripts/phase10_reviewer_response.py
```

## Data Sources
- UN World Population Prospects 2024
- IMF World Economic Outlook
- Penn World Table 10.01
- Chinn-Ito KAOPEN Index
- Lane & Milesi-Ferretti External Wealth of Nations
- Aizenman-Chinn-Ito Trilemma Indices
- Ilzetzki-Reinhart-Rogoff Exchange Rate Regimes

## Notes
- All analysis uses the 140-country expanded panel (EBA-49 + SSA-20 + EU expansion + Tier 1 expansion)
- The `src/` modules are from the multilateral/followup project and contain the expanded country lists
- Panel: 19,115 obs, 237 countries
- KAOPEN mediates 74% of Z->MI in OECD; only 8% attenuation overall (mediation null)
- Within-EMU: Z_dev=-216***, dist_from_DEU=-188***
- Yield spreads null: demographics don't predict spreads vs Bund (NFA dominates)
